package com.cgq.pro.entity;

import java.util.HashMap;
import java.util.Map;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import com.cgq.base.entity.Base;

@Entity
@Table(name="fd_user")
public class User extends Base {
	
	private String id;
	private String num;
	/**密码*/
	private String password;
	/**权限*/
	private Permission perId;
	
	@Id
	@Column(name = "uid")
	public String getId() {
		return id;
	}
	public void setId(String id) {
		this.id = id;
	}
	@Column
	public String getNum() {
		return num;
	}
	public void setNum(String num) {
		this.num = num;
	}
	@Column(name="password")
	public String getPassword() {
		return password;
	}
	public void setPassword(String password) {
		this.password = password;
	}
	
	@ManyToOne
	@JoinColumn(name="perid")
	public Permission getPerId() {
		return perId;
	}
	public void setPerId(Permission perId) {
		this.perId = perId;
	}
	@Override
	public Map<String, Object> toMap() {
		Map<String, Object> map=new HashMap<String, Object>();
		map.put("id", id);
		map.put("num", num);
		map.put("name", name);
		map.put("permission", perId.getName());
		map.put("remark", remark==null?"":remark);
		return map;
	}
}
